package com.block.product.service.impl;

import com.block.common.model.dto.UserInfoDTO;
import com.block.db.entity.ProductInfo;
import com.block.db.entity.ProductProfitAddup;
import com.block.db.mapper.ProductProfitAddupMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.block.product.service.IProductProfitAddupService;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2022-08-30
 */
@Service
public class ProductProfitAddupServiceImpl extends ServiceImpl<ProductProfitAddupMapper, ProductProfitAddup> implements IProductProfitAddupService {

    @Override
    public boolean saveProdProfitAddupInfo(ProductInfo productInfo, String dateInfo, UserInfoDTO userInfoDTO, String sceneId) {

        ProductProfitAddup profitAddup = new ProductProfitAddup();
        profitAddup.setProductId(productInfo.getId());
        profitAddup.setProductName(productInfo.getProductName());
        profitAddup.setDateInfo(dateInfo);
        profitAddup.setUserId(productInfo.getUserId());

        profitAddup.setSceneId(sceneId);
        profitAddup.setUid(userInfoDTO.getUid());
        profitAddup.setIp(userInfoDTO.getIp());
        profitAddup.setChannelCode(userInfoDTO.getChannelCode());
        profitAddup.setChannelName(userInfoDTO.getChannelName());
        profitAddup.setReqChannelCode(userInfoDTO.getReqChannelCode());
        profitAddup.setReqChannelName(userInfoDTO.getReqChannelName());
        profitAddup.setClientType(userInfoDTO.getClientType());

        return this.save(profitAddup);
    }
}
